package cn.yu.meeting.common.config;

import cn.yu.meeting.common.interceptors.LoginInterceptor;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.context.annotation.Configuration;
import org.springframework.web.servlet.config.annotation.InterceptorRegistry;
import org.springframework.web.servlet.config.annotation.WebMvcConfigurer;

@Configuration
public class WevConfig implements WebMvcConfigurer {
    @Autowired
    private LoginInterceptor loginInterceptor;
    //定义一个String数组
    final String[] excludes = new String[]{"/login/loginByMobile", "/login/registerByMobile"};


    @Override
    public void addInterceptors(InterceptorRegistry registry) {
        /*
         *设置拦截器,并且登录和注册接口不拦截
         */
        registry.addInterceptor(loginInterceptor).excludePathPatterns(excludes);
    }
}
